package com.huatai.datacenter.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.huatai.common.api.R;
import com.huatai.datacenter.entity.CodeEntity;
import com.huatai.datacenter.service.CodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author gusiyi
 * @version 1.0
 * @className CodeController
 * @description 描述：编码类查询表
 * @date 2023/5/26 10:50
 */
@RestController
@RequestMapping("/code")
@Api(value = "编码类",tags = "编码类")
public class CodeController {

	@Autowired
	private CodeService codeService;

	@RequestMapping("/query")
	@ApiOperation(value = "查询编码类型",notes = "pageIndex与pageSize不传则默认全部查询")
	@ApiOperationSupport(order = 1, includeParameters = {
		"codeEntity.pageIndex",
		"codeEntity.pageSize",
		"codeEntity.type",
		"codeEneity.parentNum"
	})
	public R<Page<CodeEntity>> queryCode(@RequestBody CodeEntity codeEntity){
		return R.data(codeService.getListByType(codeEntity),"获取"+codeEntity.getType()+"编码成功");
	}

}
